import Search from './pages/Search';
import React from 'react';
import { BrowserRouter as Router, Route, Switch } from 'react-router-dom';
import AuthRoutetr from './components/AuthRoute';
import Loading from './components/Loading';
import Article from './pages/Article';
import Chat from './pages/Profile/Chat';
import Edit from './pages/Profile/Edit';
import Feedback from './pages/Profile/Feedback';
import Result from './pages/Search/Result';
import Test from './pages/Test';
const Login = React.lazy(() => import('@/pages/Login'));
const Layout = React.lazy(() => import('@/pages/Layout'));
export default function App() {
  return (
    <Router>
      <React.Suspense fallback={<Loading />}>
        <Switch>
          <Route path="/login" component={Login} />
          <Route path="/search" component={Search} exact />
          <Route path="/article/:id" component={Article} />
          <Route path="/search/result" component={Result} />
          <AuthRoutetr path="/profile" component={Edit} />
          <AuthRoutetr path="/profile/edit" component={Edit} />
          <AuthRoutetr path="/profile/feedback" component={Feedback} />
          <AuthRoutetr path="/profile/chat" component={Chat} />
          <Route path="/test" component={Test} />
          <Route path="/" component={Layout} />
        </Switch>
      </React.Suspense>
    </Router>
  );
}
